import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'

var gltfWithDracoLoder = function () {
  const loader = new GLTFLoader()
  const dracoLoader = new DRACOLoader()
  //设置解码路径为绝对路径 注意******
  const decoderPath = `${location.origin}/3d/draco/`
  dracoLoader.setDecoderPath(decoderPath)

  loader.setDRACOLoader(dracoLoader)
  return {
    loader,
    dracoLoader
  }
}

export { gltfWithDracoLoder }
